// dnSpy decompiler from Assembly-CSharp.dll class: HexTileModelSelector
using System;
using UnityEngine;

public class HexTileModelSelector : CheckedMonoBehaviour
{
	private void CheckIfModelsListExists()
	{
		if (this.models != null)
		{
			return;
		}
		this.models = new HexTileModelSelector.Model[]
		{
			new HexTileModelSelector.Model(this.model_0, 0),
			new HexTileModelSelector.Model(this.model_6, 127),
			new HexTileModelSelector.Model(this.model_1, 1),
			new HexTileModelSelector.Model(this.model_5, 31),
			new HexTileModelSelector.Model(this.model_2_60, 3),
			new HexTileModelSelector.Model(this.model_2_120, 5),
			new HexTileModelSelector.Model(this.model_2_180, 9),
			new HexTileModelSelector.Model(this.model_3_60_60, 7),
			new HexTileModelSelector.Model(this.model_3_60_120, 11),
			new HexTileModelSelector.Model(this.model_3_60_180, 19),
			new HexTileModelSelector.Model(this.model_3_120_120, 21),
			new HexTileModelSelector.Model(this.model_4_60_60_60, 15),
			new HexTileModelSelector.Model(this.model_4_60_60_120, 23),
			new HexTileModelSelector.Model(this.model_4_60_120_60, 27)
		};
	}

	public GameObject CreateModelForNeighborsBitset6(byte neighborsBitset6)
	{
		this.CheckIfModelsListExists();
		foreach (HexTileModelSelector.Model model in this.models)
		{
			int j = 0;
			while (j < 6)
			{
				byte b = MathUtils.RotateBitset6Left(model.neighborsBitset6, j);
				if (b == neighborsBitset6)
				{
					if (null != model.prefab)
					{
						Quaternion rotation = Quaternion.AngleAxis((float)j * 60f, Vector3.up);
						return UnityEngine.Object.Instantiate<GameObject>(model.prefab, Vector3.zero, rotation);
					}
					return null;
				}
				else
				{
					j++;
				}
			}
		}
		UnityEngine.Debug.LogError("Couldn't find model for neighbors bitset: " + neighborsBitset6);
		return null;
	}

	public GameObject model_0;

	public GameObject model_1;

	public GameObject model_2_60;

	public GameObject model_2_120;

	public GameObject model_2_180;

	public GameObject model_3_60_60;

	public GameObject model_3_60_120;

	public GameObject model_3_60_180;

	public GameObject model_3_120_120;

	public GameObject model_4_60_60_60;

	public GameObject model_4_60_60_120;

	public GameObject model_4_60_120_60;

	public GameObject model_5;

	public GameObject model_6;

	public bool considersBorderAsNeighbor;

	private HexTileModelSelector.Model[] models;

	private struct Model
	{
		public Model(GameObject prefab, byte neighborsBitset6)
		{
			this.prefab = prefab;
			this.neighborsBitset6 = neighborsBitset6;
		}

		public GameObject prefab;

		public byte neighborsBitset6;
	}
}
